#include <iostream>
using namespace std;

// 自定义整型

class MyInteger
{
  friend ostream &operator<<(ostream &cout, MyInteger myint);

public:
  MyInteger()
  {
    m_num = 0;
  }

  // 重载前置++运算符
  MyInteger &operator++()
  {
    m_num++;
    return *this;
  }

  // 重载后置++运算符
  // int 代表占位参数，可以用于区分前置和后置递增
  MyInteger operator++(int)
  {
    // 先 记录当时结果
    MyInteger temp = *this;
    // 后 递增
    m_num++;

    // 最后将记录结果做返回
    return temp;
  }

private:
  int m_num;
};

ostream &operator<<(ostream &cout, MyInteger myint)
{
  cout << myint.m_num;
  return cout;
}

void test01()
{
  MyInteger myint;

  cout << ++(++myint) << endl;
  cout << myint << endl;
}

void test02()
{
  MyInteger myint;

  cout << myint++ << endl;
  cout << myint << endl;
}

int main(int argc, char const *argv[])
{

  test01();
  test02();

  return 0;
}